package com.apes.fn.server.praticalFunction;

import com.alibaba.fastjson.JSONObject;
import com.apes.framework.api.DomainService;
import com.apes.framework.api.SpringManager;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import com.apes.scm.rbac.repository.PostRepository;
import org.springframework.stereotype.Service;

/**
 * Created by lishikun on 2021/6/4 14:38
 */
@Service("smartAccessoriesService")
public class SmartAccessoriesService extends DomainService {

    public Object find(SimpleRequest request) {
        JSONObject jo = request.getJO();
        if (jo.getJSONArray("condition").size() == 0)
            throw new RuntimeException("查询条件不能为空");
        jo.put("sartAccessories", true);
        if (SpringManager.getBean(PostRepository.class).findOne(request.getPostId()).getDept() == null)
            jo.put("vendorCode", true);
        return invoke("fn.customerCar.findAll", jo);
    }
}
